package server;

import Constans.Constants;
import bean.RpcResult;
import com.alibaba.fastjson.JSONObject;
import request.RpcReq;

/**
 * @author:zhengyilong
 * @email:1797344574@qq.com
 * @phone:13479394730
 * @desc:该类用于实现通过rpc访问调用bitcoin core的getblockcount功能
 * @DateTime:2021/12/15 14:57
 **/
public class GetBlockCount {

    //获取当前节点区块高度
    public static RpcResult getBlockCount(int id){
        //调用rpc请求公共部分
        String result = RpcReq.rpcReq(id, Constants.GETBLOCKCOUNT);

        //将响应结果反序列化并返回
        return JSONObject.parseObject(result, RpcResult.class);
    }

}

